import 'package:cbec_app/entity/home/content/content_data.dart';
import 'package:cbec_app/generated/json/base/json_field.dart';
import 'package:cbec_app/generated/json/group_goods_data_entity.g.dart';
import 'dart:convert';
export 'package:cbec_app/generated/json/group_goods_data_entity.g.dart';

@JsonSerializable()
class GroupGoodsDataEntity extends ContentData {
  @JSONField(name: "page_margin")
  int? pageMargin = 0;
  @JSONField(name: "size_type")
  String? sizeType = '';
  @JSONField(name: "show_origin_price")
  String? showOriginPrice = '';
  @JSONField(name: "display_scale")
  String? displayScale = '';
  @JSONField(name: "image_fill_style")
  String? imageFillStyle = '';
  String? title = '';
  @JSONField(name: "corner_mark_type")
  String? cornerMarkType = '';
  @JSONField(name: "border_radius_type")
  String? borderRadiusType = '';
  @JSONField(name: "text_align_type")
  String? textAlignType = '';
  @JSONField(name: "goods_margin")
  int? goodsMargin = 0;
  @JSONField(name: "show_corner_mark")
  String? showCornerMark = '';
  String? uuid = '';
  @JSONField(name: "show_sold_num")
  String? showSoldNum = '';
  String? size = '';
  @JSONField(name: "nav_style")
  String? navStyle = '';
  @JSONField(name: "text_style_type")
  String? textStyleType = '';
  String? price = '';
  String? sticky = '';
  @JSONField(name: "show_sub_title")
  String? showSubTitle = '';
  @JSONField(name: "sub_entry")
  List<GroupGoodsDataSubEntry>? subEntry = [];
  @JSONField(name: "corner_mark_image")
  String? cornerMarkImage = '';
  @JSONField(name: "show_all_goods_tag")
  String? showAllGoodsTag = '';

  GroupGoodsDataEntity() {
    type = 'goods_group';
  }

  factory GroupGoodsDataEntity.fromJson(Map<String, dynamic> json) => $GroupGoodsDataEntityFromJson(json);

  @override
  Map<String, dynamic> toJson() => $GroupGoodsDataEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  @override
  ContentData fromJson(Map<String, dynamic> json) {
    return GroupGoodsDataEntity.fromJson(json);
  }
}

@JsonSerializable()
class GroupGoodsDataSubEntry {
  bool? isShowAll = false;
  @JSONField(name: "goods_number")
  int? goodsNumber = 0;
  String? createTime = '';
  @JSONField(name: "tag_name")
  String? tagName = '';
  String? name = '';
  int? channelNum = 0;
  String? id = '';

  GroupGoodsDataSubEntry();

  factory GroupGoodsDataSubEntry.fromJson(Map<String, dynamic> json) => $GroupGoodsDataSubEntryFromJson(json);

  Map<String, dynamic> toJson() => $GroupGoodsDataSubEntryToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
